JAVASCRIPT code is often used to update/render specific areas of a web page by modifying the web page's current elements. JAVASCRIPT messages can be used to alert users of errors and other types of messaging that are separate from a web application server. At times, the JAVASCRIPT messages include text to be translated. Internationalization of web application pages, including JAVASCRIPT messages, involves developing the web application to be adapted to various languages and regions without having to make extensive application programming changes. Localization is the process of adapting an internationalized application for a specific region or language by adding locale-specific components and translating text. Internationalization and localization is often abbreviated to ‘i18n’.
Conventional internationalization and localization solutions usually involve designing an application to reference resource libraries. Traditionally, an application's client-side code uses a ‘gettext’ client-side method to access a large resource library of translated strings, which is downloaded to the client from a server. A server sends all known translated strings to a client (in multiple locales) in the form of a resource library. Subsequently, the client looks up a translation of the components of the client-side code in the resource library and retrieves the translated strings from the library. Use of a large resource library on the client, however, results in an inefficient use of client resources. Clients needlessly download a library of thousands of translated strings, but utilize only a fraction of the library, using more network bandwidth than needed. For example, a client downloads five thousand translated strings and searches thousands of translated strings, when needing to retrieve, for example, only 20 translated strings for a web application page. In another example, a client does not need many of the locales that are provided by a large resource library. Some traditional solutions use JSON (JAVASCRIPT Object Notation) data structures to hold translations for all locales on the client. The JSON format is often used for serializing and transmitting structured data over a network connection and is primarily used to transmit data between a server and a web application. As an application grows, the resource library of translated strings also grows, and the use of JSON leads to scalability issues. The installation of a large resource library on the client and the use of the JSON format increases the bandwidth needed to support the client, which creates more strain on a server since many clients are talking to the same server.